home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Performance Co-Pilot 1.3
/
SGI Performance Co-Pilot 1.3.iso
/
dist
/
dist6.4
/
pcp.idb
/
usr
/
sbin
/
dkvis.z
/
dkvis
Wrap
Text File
|
1997-04-03
|
6KB
|
261 lines
#!/bin/sh
#
# Copyright (c) 1994 Silicon Graphics, Inc.
# ALL RIGHTS RESERVED.
#
# U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND
# Use, duplication or disclosure by the Government is subject to
# restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph
# (c)(1)(ii) of the Rights in Technical Data and Computer Software clause
# at DFARS 252.227-7013 and/or similar or successor clauses in the FAR,
# or the DOD or NASA FAR Supplement. Contractor/manufacturer is Silicon
# Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
#
# THIS SOFTWARE CONTAINS CONFIDENTIAL AND PROPRIETARY INFORMATION OF
# SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, DISTRIBUTION, OR
# DISCLOSURE IS STRICTLY PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN
# PERMISSION OF SILICON GRAPHICS, INC.
# /
#
# $Id: dkvis.sh,v 2.12 1997/03/21 08:24:03 kenmcd Exp $
#
tmp=/tmp/$$
trap "rm -f $tmp.*; exit" 0 1 2 3 15
rm -f $tmp.*
. /usr/pcp/lib/pmview-args
_usage()
{
echo >$tmp.msg 'Usage: '$prog' [options]
options:
-m maxrate maximum I/O rate expected (integer) [default 100]
-r display Read I/O rate
-v version generate scene for different versions of pmview [default 2]
-V verbose/diagnostic output
-w display Write I/O rate
pmview(1) options:'
_pmview_usage >>$tmp.msg
echo >>$tmp.msg
echo 'Default title is: Total I/O Rate for Host' >>$tmp.msg
_pmview_info -f $tmp.msg
}
verbose=false
version="2"
type=total
Type=Total
max=150
_pmview_args "$@"
if [ -n "$otherArgs" ]
then
while getopts "?m:rv:Vw" c $otherArgs
do
case $c
in
m)
max=$OPTARG
# and now the obscure +ve integer checking bit
# ...note the creative use of unary - to prevent leading signs
if [ "X-$max" != "X`expr 0 + -$max 2>/dev/null`" ]
then
_pmview_error "-m option must have a positive integral argument"
# NOTREACHED
fi
;;
r)
if [ $type != total ]
then
_pmview_error "only one -r or -w option may be specified"
# NOTREACHED
fi
type=read
Type=Read
;;
v)
version=$OPTARG
if [ $version != "1" -a $version != "2" ]
then
_pmview_error "only versions 1 and 2 supported for -v"
# NOTREACHED
fi
;;
V)
verbose=true
;;
w)
if [ $type != total ]
then
_pmview_error "only one -r or -w option may be specified"
# NOTREACHED
fi
type=write
Type=Write
;;
?)
_usage
exit 1
;;
esac
done
set -- $otherArgs
shift `expr $OPTIND - 1`
if [ $# -gt 0 ]
then
_usage
exit 1
fi
fi
if [ "X$arch" != X ]
then
pmprobe $namespace -a $arch -I irix.disk.dev.$type >$tmp.dk
host=`pmdumplog -l $arch | awk '/^Performance/ {print $5}' | sed -e 's/,//g'`
[ "X$host" = X ] && host="unknown host"
host="$host (Archive $arch)"
elif [ "X$host" = X ]
then
host=`/usr/bsd/hostname`
fi
# if not an archive, contact the host
[ ! -f $tmp.dk ] && pmprobe $namespace -h $host -I irix.disk.dev.$type >$tmp.dk
eval `sed <$tmp.dk \
-e 's/"//g' \
-e 's/$/ /' \
-e "s/^[^ ]* /ndisk=/" \
-e 's/ / disks="/' \
-e 's/"$/""/' \
-e 's/ $/"/'`
if [ -z "$disks" -o -z "$ndisk" -o "$ndisk" -lt 1 ]
then
echo "Cannot get disk inventory!" >$tmp.msg
cat $tmp.dk >>$tmp.msg
_pmview_error -f $tmp.msg
# NOTREACHED
fi
rm -f $tmp.conf
touch $tmp.conf
if [ "$version" = 1 ]
then
vstring="# pmview 1.0"
else
vstring="pmview Version $version.0"
fi
cat << end-of-file >> $tmp.conf
$vstring
#
# dkvis
#
end-of-file
if $verbose
then
echo "# Disk Inventory:" >> $tmp.conf
echo $disks | fmt | sed -e 's/^/# /' >> $tmp.conf
fi
if [ "$version" = "2" ]
then
#
# pmview 2.0
#
echo '
_scale 1.1
_colorlist colors ( green1 blue1 red1 cyan1 purple1 yellow1 )
_labeledbar (
_colorlist colors
_metrics (' >> $tmp.conf
echo "$disks" \
| tr ' ' '\012' \
| sed \
-e 's/.../& /' \
-e 's/\([0-9]\)d\([0-9]\)/\1 d \2/' \
-e 's/\([0-9]\)l\([0-9]\)/\1 l \2/' \
| sort +0 -1 +1n -2 +3n -4 \
| awk '
BEGIN { type = ""; ctl = ""; list = ""; labels = ""}
{ if ($1 != type || $2 != ctl) {
if (list != "")
print " irix.disk.dev.'$type'[" list "] " '$max'
list = $1 $2 $3 $4 $5 $6
labels = labels " \"" $1 $2 "\""
type = $1
ctl = $2
}
else
list = list "," $1 $2 $3 $4 $5 $6
}
END { if (list != "")
print " irix.disk.dev.'$type'[" list "] " '$max'
print " )"
print " _metriclabels (" labels " )"
print ")"
}' >> $tmp.conf
else
#
# pmview 1.0
#
echo "$disks" \
| tr ' ' '\012' \
| sed \
-e 's/.../& /' \
-e 's/\([0-9]\)d\([0-9]\)/\1 d \2/' \
-e 's/\([0-9]\)l\([0-9]\)/\1 l \2/' \
| sort +0 -1 +1n -2 +3n -4 \
| awk '
BEGIN { type = ""; ctl = ""; x = 0
col[0] = "0.0 1.0 0.0"
col[1] = "0.0 0.0 1.0"
col[2] = "1.0 0.0 0.0"
col[3] = "0.0 1.0 1.0"
col[4] = "1.0 1.0 0.0"
col[5] = "1.0 0.0 1.0"
col[6] = "0.0 1.0 0.5"
col[7] = "0.5 0.0 1.0"
col[8] = "1.0 0.5 0.0"
col[9] = "0.5 1.0 0.5"
col[10] = "1.0 0.5 0.5"
col[11] = "0.5 0.5 1.0"
}
{ if ($1 != type || $2 != ctl) {
type = $1; ctl = $2; x++; y = 0; tag = $1 $2
}
else
tag = "-"
print x " " y " " col[y % 12] " '$max' " tag " irix.disk.dev.'$type' " $1 $2 $3 $4 $5 $6
y++
}' >> $tmp.conf
fi
$verbose && cat $tmp.conf
if [ -z "$titleArg" ]
then
titleArg="$Type Disk I/O Rate for Host $host"
fi
eval pmview <$tmp.conf $args -title "'$titleArg'" -xrm "'*iconName: dkvis'"
exit